package com.blockchain.console.servlets.system.bank;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.blockchain.console.service.system.BankManage;
import com.blockchain.console.service.system.entity.Bank;
import com.blockchain.console.servlets.system.AbstractSystemServlet;
import com.blockchain.framework.http.servlet.annotation.Right;
import com.blockchain.framework.service.ServiceSession;
import com.blockchain.framework.service.query.Paging;
import com.blockchain.framework.service.query.PagingResult;
import com.blockchain.util.parser.IntegerParser;
@Right(id = "C_SYS_SEARCHBANK",isMenu=true, name = "银行设置")
public class SearchBank extends AbstractSystemServlet{

	private static final long serialVersionUID = 1L;

	@Override
	protected void processGet(HttpServletRequest request,
			HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		processPost(request, response, serviceSession);
	}

	@Override
	protected void processPost(final HttpServletRequest request,
			HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		BankManage manage = serviceSession.getService(BankManage.class);
		Paging paging = new Paging() {
			
			@Override
			public int getSize() {
				return 10;
			}
			
			@Override
			public int getCurrentPage() {
				return IntegerParser.parse(request.getParameter(PAGING_CURRENT));
			}
		};
		PagingResult<Bank> result = manage.searchBank(request.getParameter("name"), paging);
		request.setAttribute("result", result);
		forwardView(request, response, getClass());
	}
	
	

}
